package com.data.structure.demo01;

import java.util.EmptyStackException;
import java.util.Stack;

public class DemoT1 {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
         try{
             Integer valuePop = stack.pop();
             System.out.println("Popped of "+valuePop);
         }catch(EmptyStackException e){
             System.out.println("Stack is empty");
         }

        try{
            Integer peek = stack.peek();
            System.out.println("value : "+peek);
        }catch(EmptyStackException e){
            System.out.println("Stack is empty");
        }

        boolean empty = stack.isEmpty();
        System.out.println("stack 是不是空："+empty);

    }
}
